package cn.funeralobjects.aoss.converter;

import cn.funeralobjects.aoss.enums.Versioning;

import javax.persistence.AttributeConverter;

/**
 * Converter of Versioning
 *
 * @author FuneralObjects
 * Create date: 2020/6/1 11:55 AM
 */
public class VersioningConverter implements AttributeConverter<Versioning, String> {
    @Override
    public String convertToDatabaseColumn(Versioning attribute) {
        return attribute == null ? null : attribute.getCode();
    }

    @Override
    public Versioning convertToEntityAttribute(String dbData) {
        return dbData == null ? null : Versioning.of(dbData);
    }
}
